library(googlesheets4)
library(sf)
library(sfheaders)
library(tidyverse)
library(southernMaps)
library(mapview)
library(terra)
library(tidyterra)
library(rcartocolor)
library(ggnewscale)
library(ggspatial)
library(kableExtra)
library(ggrepel)
theme_set(theme_bw())Plan for Fiordland BRUV FLD25
Setup
Load NZ coastline data
… and convert to sf object.
nztm <- detailed_nz_islands |> st_as_sf()Marine reserves data
load(file = "data/mr_fiordland.Rdata")Load strata
strata <- st_read("data/FLD25_Strata.kml")Reading layer `Strata' from data source
`C:\git_projects\fiordland_bruv\data\FLD25_Strata.kml' using driver `KML'
Simple feature collection with 13 features and 2 fields
Geometry type: POLYGON
Dimension: XYZ
Bounding box: xmin: 166.3883 ymin: -45.8432 xmax: 167.0177 ymax: -45.47082
z_range: zmin: 0 zmax: 0
Geodetic CRS: WGS 84
plot(strata)Load mark
mark <- png::readPNG("img/mark_blank.png") |> grid::rasterGrob(interpolate=TRUE)BRUV data
Load from Google Sheet
… and convert to sf object.
fld24 <- read_sheet(
"https://docs.google.com/spreadsheets/d/1IQfLTiWTQnTGynuF7fUu8htJxKZuIVJw4OK6y9qRfU8",
sheet="FLD24") |>
mutate(Depth = coalesce(`Depth sensor`,`Depth sounder`)) |>
st_as_sf(coords = c('Longitude','Latitude'), crs=4326) |>
st_join(strata["Name"]) |>
filter(Quality %in% c("Good", "OK"))Write full dataset to csv file (for copying stratum column into BRUVmetadata – actually nah)
read_sheet(
"https://docs.google.com/spreadsheets/d/1IQfLTiWTQnTGynuF7fUu8htJxKZuIVJw4OK6y9qRfU8",
sheet="FLD24") |>
mutate(Depth = coalesce(`Depth sensor`,`Depth sounder`)) |>
st_as_sf(coords = c('Longitude','Latitude'), crs=4326) |>
st_join(strata["Name"]) |>
write_csv(file = "data/fld24_strata.csv")✔ Reading from "BRUVmetadata".
✔ Range ''FLD24''.
st_as_s2(): dropping Z and/or M coordinate
Export data for printing
dstrat <- c("DZ1","DZ2","DR2","DZ3","DZ4" )decimal_to_dm <- function(decimal_degrees) {
degrees <- floor(decimal_degrees)
minutes <- (decimal_degrees - degrees) * 60
return(paste0(degrees, "° ", formatC(minutes, format = "f", digits = 3), "'"))
}fld24_toprint <- fld24 |>
filter(Quality != "BAD") |>
as_data_frame() |>
transmute(
SiteID,
SetRep = substring(OpCode, 7, 13),
Loc = Location,
Stratum = Name |>
fct_relevel(dstrat),
Depth,
lat = st_coordinates(fld24)[,2] |> round(5),
lon = st_coordinates(fld24)[,1] |> round(5),
lat2 = st_coordinates(fld24)[,2] |> decimal_to_dm(),
lon2 = st_coordinates(fld24)[,1] |> decimal_to_dm()
) |>
arrange(Stratum)Warning: `as_data_frame()` was deprecated in tibble 2.0.0.
ℹ Please use `as_tibble()` (with slightly different semantics) to convert to a
tibble, or `as.data.frame()` to convert to a data frame.
kable(fld24_toprint)| SiteID | SetRep | Loc | Stratum | Depth | lat | lon | lat2 | lon2 |
|---|---|---|---|---|---|---|---|---|
| LC01 | S02_R01 | Luncheon Cove | DZ1 | 35.9 | -45.77672 | 166.4945 | -46° 13.397’ | 166° 29.670’ |
| LC02 | S02_R02 | Luncheon Cove | DZ1 | 23.0 | -45.77042 | 166.4982 | -46° 13.775’ | 166° 29.891’ |
| LC03 | S02_R03 | Luncheon Cove | DZ1 | 34.0 | -45.77522 | 166.5058 | -46° 13.487’ | 166° 30.345’ |
| LC08 | S02_R05 | Luncheon Cove | DZ1 | 40.0 | -45.76553 | 166.5292 | -46° 14.068’ | 166° 31.751’ |
| LC06 | S02_R06 | Luncheon Cove | DZ1 | 42.0 | -45.77145 | 166.5326 | -46° 13.713’ | 166° 31.955’ |
| AI08 | S03_R02 | Anchor Island | DZ1 | 21.0 | -45.73870 | 166.5252 | -46° 15.678’ | 166° 31.514’ |
| AI09 | S03_R03 | Anchor Island | DZ1 | 38.0 | -45.74827 | 166.5181 | -46° 15.104’ | 166° 31.084’ |
| AI10 | S03_R04 | Anchor Island | DZ1 | 28.0 | -45.74457 | 166.5100 | -46° 15.326’ | 166° 30.599’ |
| AI11 | S03_R05 | Anchor Island | DZ1 | 71.0 | -45.74618 | 166.5016 | -46° 15.229’ | 166° 30.094’ |
| AI12 | S03_R06 | Anchor Island | DZ1 | 71.0 | -45.75023 | 166.5000 | -46° 14.986’ | 166° 30.003’ |
| AI01 | S04_R01 | Anchor Island | DZ1 | 41.8 | -45.75005 | 166.5258 | -46° 14.997’ | 166° 31.549’ |
| AI02 | S04_R02 | Anchor Island | DZ1 | 79.0 | -45.74478 | 166.5167 | -46° 15.313’ | 166° 31.000’ |
| AI03 | S04_R03 | Anchor Island | DZ1 | 20.0 | -45.74017 | 166.5253 | -46° 15.590’ | 166° 31.518’ |
| LC04 | S05_R04 | Luncheon Cove | DZ1 | 86.0 | -45.77767 | 166.5152 | -46° 13.340’ | 166° 30.910’ |
| LC05 | S05_R05 | Luncheon Cove | DZ1 | 45.0 | -45.77575 | 166.5234 | -46° 13.455’ | 166° 31.406’ |
| LC07 | S05_R06 | Luncheon Cove | DZ1 | 30.0 | -45.76930 | 166.5201 | -46° 13.842’ | 166° 31.206’ |
| OF01 | S22_R01 | Outer Five Fingers | DZ1 | 34.0 | -45.71893 | 166.4898 | -46° 16.864’ | 166° 29.391’ |
| OF02 | S22_R02 | Outer Five Fingers | DZ1 | 44.0 | -45.72385 | 166.4839 | -46° 16.569’ | 166° 29.035’ |
| OF03 | S22_R03 | Outer Five Fingers | DZ1 | 25.0 | -45.72788 | 166.4762 | -46° 16.327’ | 166° 28.573’ |
| OF04 | S22_R04 | Outer Five Fingers | DZ1 | 34.0 | -45.73192 | 166.4712 | -46° 16.085’ | 166° 28.275’ |
| OF05 | S22_R05 | Outer Five Fingers | DZ1 | 17.0 | -45.73392 | 166.4650 | -46° 15.965’ | 166° 27.902’ |
| OF06 | S22_R06 | Outer Five Fingers | DZ1 | 31.0 | -45.73877 | 166.4598 | -46° 15.674’ | 166° 27.586’ |
| EA02 | S01_R02 | East Anchor | DZ2 | 23.0 | -45.76108 | 166.5369 | -46° 14.335’ | 166° 32.212’ |
| EA03 | S01_R03 | East Anchor | DZ2 | 79.0 | -45.75900 | 166.5446 | -46° 14.460’ | 166° 32.677’ |
| EA08 | S01_R04 | East Anchor | DZ2 | 17.0 | -45.77003 | 166.5534 | -46° 13.798’ | 166° 33.207’ |
| EA05 | S01_R05 | East Anchor | DZ2 | 65.0 | -45.76277 | 166.5631 | -46° 14.234’ | 166° 33.788’ |
| EA06 | S01_R06 | East Anchor | DZ2 | 86.0 | -45.76553 | 166.5525 | -46° 14.068’ | 166° 33.151’ |
| AI07 | S03_R01 | Anchor Island | DZ2 | 49.1 | -45.73245 | 166.5272 | -46° 16.053’ | 166° 31.631’ |
| AI04 | S04_R04 | Anchor Island | DZ2 | 83.0 | -45.73032 | 166.5401 | -46° 16.181’ | 166° 32.407’ |
| AI05 | S04_R05 | Anchor Island | DZ2 | 54.0 | -45.74125 | 166.5464 | -46° 15.525’ | 166° 32.786’ |
| AI06 | S04_R06 | Anchor Island | DZ2 | 29.0 | -45.74172 | 166.5556 | -46° 15.497’ | 166° 33.333’ |
| EA01 | S05_R01 | East Anchor | DZ2 | 57.0 | -45.76440 | 166.5409 | -46° 14.136’ | 166° 32.455’ |
| EA04 | S05_R02 | East Anchor | DZ2 | 30.0 | -45.75715 | 166.5584 | -46° 14.571’ | 166° 33.505’ |
| EA07 | S05_R03 | East Anchor | DZ2 | 38.0 | -45.75388 | 166.5717 | -46° 14.767’ | 166° 34.304’ |
| RI01 | S08_R01 | Resolution Island | DZ2 | 19.2 | -45.72102 | 166.5831 | -46° 16.739’ | 166° 34.987’ |
| RI02 | S08_R02 | Resolution Island | DZ2 | 34.0 | -45.71980 | 166.5733 | -46° 16.812’ | 166° 34.396’ |
| PP02 | S08_R05 | Pigeon & Parrot Islands | DZ2 | 40.0 | -45.71513 | 166.5280 | -46° 17.092’ | 166° 31.681’ |
| PP03 | S08_R06 | Pigeon & Parrot Islands | DZ2 | 32.0 | -45.72005 | 166.5267 | -46° 16.797’ | 166° 31.605’ |
| LI02 | S17_R02 | Long Island | DZ2 | 30.0 | -45.77093 | 166.6043 | -46° 13.744’ | 166° 36.256’ |
| LI03 | S17_R03 | Long Island | DZ2 | 23.0 | -45.77240 | 166.6003 | -46° 13.656’ | 166° 36.016’ |
| LI04 | S17_R04 | Long Island | DZ2 | 25.0 | -45.77600 | 166.6013 | -46° 13.440’ | 166° 36.076’ |
| PH01 | S19_R01 | Pickersgill Harbour | DZ2 | 31.5 | -45.79447 | 166.5908 | -46° 12.332’ | 166° 35.445’ |
| PH02 | S19_R02 | Pickersgill Harbour | DZ2 | 33.0 | -45.79415 | 166.5842 | -46° 12.351’ | 166° 35.051’ |
| PH03 | S19_R03 | Pickersgill Harbour | DZ2 | 42.0 | -45.79445 | 166.5934 | -46° 12.333’ | 166° 35.602’ |
| PH04 | S19_R04 | Pickersgill Harbour | DZ2 | 32.0 | -45.78363 | 166.5830 | -46° 12.982’ | 166° 34.981’ |
| PH05 | S19_R05 | Pickersgill Harbour | DZ2 | 81.0 | -45.78190 | 166.6001 | -46° 13.086’ | 166° 36.005’ |
| ES01 | S21_R01 | Earshell Cove | DZ2 | 31.2 | -45.72475 | 166.5894 | -46° 16.515’ | 166° 35.366’ |
| ES02 | S21_R02 | Earshell Cove | DZ2 | 48.0 | -45.72678 | 166.5842 | -46° 16.393’ | 166° 35.055’ |
| ES03 | S21_R03 | Earshell Cove | DZ2 | 21.0 | -45.73117 | 166.5777 | -46° 16.130’ | 166° 34.661’ |
| ES04 | S21_R04 | Earshell Cove | DZ2 | 46.0 | -45.73853 | 166.5701 | -46° 15.688’ | 166° 34.204’ |
| ES05 | S21_R05 | Earshell Cove | DZ2 | 60.0 | -45.74320 | 166.5735 | -46° 15.408’ | 166° 34.412’ |
| ES06 | S21_R06 | Earshell Cove | DZ2 | 52.7 | -45.74770 | 166.5760 | -46° 15.138’ | 166° 34.558’ |
| FH01 | S23_R01 | Fixed Head | DZ2 | 25.0 | -45.76270 | 166.5871 | -46° 14.238’ | 166° 35.224’ |
| FH02 | S23_R02 | Fixed Head | DZ2 | 45.0 | -45.75477 | 166.6083 | -46° 14.714’ | 166° 36.497’ |
| FH03 | S23_R03 | Fixed Head | DZ2 | 18.0 | -45.74933 | 166.6143 | -46° 15.040’ | 166° 36.860’ |
| FF01 | S06_R01 | Five Fingers | DR2 | 31.1 | -45.70582 | 166.5711 | -46° 17.651’ | 166° 34.263’ |
| FF02 | S06_R02 | Five Fingers | DR2 | 52.0 | -45.70425 | 166.5616 | -46° 17.745’ | 166° 33.697’ |
| FF03 | S06_R03 | Five Fingers | DR2 | 63.0 | -45.70360 | 166.5512 | -46° 17.784’ | 166° 33.070’ |
| FF04 | S06_R04 | Five Fingers | DR2 | 86.0 | -45.70063 | 166.5412 | -46° 17.962’ | 166° 32.471’ |
| FF05 | S06_R05 | Five Fingers | DR2 | 25.0 | -45.69333 | 166.5438 | -46° 18.400’ | 166° 32.628’ |
| FF06 | S06_R06 | Five Fingers | DR2 | 18.0 | -45.69175 | 166.5565 | -46° 18.495’ | 166° 33.392’ |
| FF07 | S07_R01 | Five Fingers | DR2 | 28.5 | -45.68888 | 166.5305 | -46° 18.667’ | 166° 31.831’ |
| FF08 | S07_R02 | Five Fingers | DR2 | 28.0 | -45.69353 | 166.5240 | -46° 18.388’ | 166° 31.437’ |
| FF09 | S07_R03 | Five Fingers | DR2 | 27.0 | -45.69867 | 166.5181 | -46° 18.080’ | 166° 31.087’ |
| FF10 | S07_R04 | Five Fingers | DR2 | 26.0 | -45.70330 | 166.5104 | -46° 17.802’ | 166° 30.627’ |
| FF11 | S07_R05 | Five Fingers | DR2 | 18.0 | -45.70938 | 166.5012 | -46° 17.437’ | 166° 30.072’ |
| FF12 | S07_R06 | Five Fingers | DR2 | 41.0 | -45.71433 | 166.4979 | -46° 17.140’ | 166° 29.872’ |
| RI03 | S08_R03 | Resolution Island | DR2 | 25.0 | -45.71353 | 166.5591 | -46° 17.188’ | 166° 33.545’ |
| PP01 | S08_R04 | Pigeon & Parrot Islands | DR2 | 39.0 | -45.70965 | 166.5481 | -46° 17.421’ | 166° 32.887’ |
| SI05 | S09_R05 | Shag Island | DZ3 | 35.0 | -45.74290 | 166.7680 | -46° 15.426’ | 166° 46.080’ |
| SI06 | S09_R06 | Shag Island | DZ3 | 28.0 | -45.74382 | 166.7570 | -46° 15.371’ | 166° 45.418’ |
| SI11 | S15_R05 | Shag Island | DZ3 | 64.0 | -45.74245 | 166.7635 | -46° 15.453’ | 166° 45.807’ |
| SI12 | S15_R06 | Shag Island | DZ3 | 45.0 | -45.74392 | 166.7555 | -46° 15.365’ | 166° 45.331’ |
| II01 | S16_R01 | Indian Island | DZ3 | 28.0 | -45.76110 | 166.6465 | -46° 14.334’ | 166° 38.788’ |
| II02 | S16_R02 | Indian Island | DZ3 | 57.0 | -45.76187 | 166.6405 | -46° 14.288’ | 166° 38.433’ |
| II03 | S16_R03 | Indian Island | DZ3 | 36.0 | -45.76823 | 166.6378 | -46° 13.906’ | 166° 38.271’ |
| II04 | S16_R04 | Indian Island | DZ3 | 46.0 | -45.76727 | 166.6315 | -46° 13.964’ | 166° 37.890’ |
| II05 | S16_R05 | Indian Island | DZ3 | 28.0 | -45.77097 | 166.6236 | -46° 13.742’ | 166° 37.417’ |
| II06 | S16_R06 | Indian Island | DZ3 | 47.0 | -45.76517 | 166.6241 | -46° 14.090’ | 166° 37.448’ |
| LI01 | S17_R01 | Long Island | DZ3 | 14.2 | -45.76587 | 166.6148 | -46° 14.048’ | 166° 36.891’ |
| LI05 | S17_R05 | Long Island | DZ3 | 38.0 | -45.77637 | 166.6087 | -46° 13.418’ | 166° 36.523’ |
| LI06 | S17_R06 | Long Island | DZ3 | 69.0 | -45.77782 | 166.6129 | -46° 13.331’ | 166° 36.771’ |
| CL01 | S18_R01 | Curlew Island | DZ3 | 38.7 | -45.78558 | 166.6075 | -46° 12.865’ | 166° 36.451’ |
| CL02 | S18_R02 | Curlew Island | DZ3 | 42.0 | -45.78937 | 166.6088 | -46° 12.638’ | 166° 36.526’ |
| CL03 | S18_R03 | Curlew Island | DZ3 | 38.0 | -45.79812 | 166.6120 | -46° 12.113’ | 166° 36.718’ |
| CL04 | S18_R04 | Curlew Island | DZ3 | 21.0 | -45.80265 | 166.5988 | -46° 11.841’ | 166° 35.930’ |
| CL05 | S18_R05 | Curlew Island | DZ3 | 33.0 | -45.80528 | 166.5881 | -46° 11.683’ | 166° 35.288’ |
| CL06 | S18_R06 | Curlew Island | DZ3 | 68.0 | -45.79398 | 166.5990 | -46° 12.361’ | 166° 35.938’ |
| PH06 | S19_R06 | Pickersgill Harbour | DZ3 | 79.0 | -45.79087 | 166.6021 | -46° 12.548’ | 166° 36.124’ |
| DC01 | S20_R01 | Duck Cove | DZ3 | 25.0 | -45.74697 | 166.6567 | -46° 15.182’ | 166° 39.400’ |
| DC02 | S23_R04 | Duck Cove | DZ3 | 46.0 | -45.74255 | 166.6531 | -46° 15.447’ | 166° 39.188’ |
| DC03 | S23_R05 | Duck Cove | DZ3 | 17.0 | -45.74692 | 166.6521 | -46° 15.185’ | 166° 39.123’ |
| DC04 | S23_R06 | Duck Cove | DZ3 | 45.0 | -45.74880 | 166.6580 | -46° 15.072’ | 166° 39.482’ |
| BW01 | S24_R01 | Bowen Channel | DZ3 | 32.8 | -45.73972 | 166.6971 | -46° 15.617’ | 166° 41.826’ |
| BW02 | S24_R02 | Bowen Channel | DZ3 | 53.0 | -45.73017 | 166.7091 | -46° 16.190’ | 166° 42.544’ |
| BW03 | S24_R03 | Bowen Channel | DZ3 | 36.0 | -45.72955 | 166.7153 | -46° 16.227’ | 166° 42.918’ |
| BW04 | S24_R04 | Bowen Channel | DZ3 | 20.0 | -45.72763 | 166.7263 | -46° 16.342’ | 166° 43.576’ |
| BW05 | S24_R05 | Bowen Channel | DZ3 | 51.0 | -45.73610 | 166.7239 | -46° 15.834’ | 166° 43.432’ |
| BW06 | S24_R06 | Bowen Channel | DZ3 | 22.0 | -45.74022 | 166.7223 | -46° 15.587’ | 166° 43.338’ |
| SI01 | S09_R01 | Shag Island | DZ4 | 49.6 | -45.74372 | 166.7880 | -46° 15.377’ | 166° 47.280’ |
| SI02 | S09_R02 | Shag Island | DZ4 | 29.0 | -45.73778 | 166.7870 | -46° 15.733’ | 166° 47.218’ |
| SI03 | S09_R03 | Shag Island | DZ4 | 24.0 | -45.73197 | 166.7870 | -46° 16.082’ | 166° 47.219’ |
| SI04 | S09_R04 | Shag Island | DZ4 | 36.0 | -45.73337 | 166.7697 | -46° 15.998’ | 166° 46.182’ |
| EC01 | S10_R01 | East Cooper Island | DZ4 | 36.4 | -45.73463 | 166.9211 | -46° 15.922’ | 166° 55.268’ |
| EC03 | S10_R03 | East Cooper Island | DZ4 | 30.0 | -45.73527 | 166.8988 | -46° 15.884’ | 166° 53.930’ |
| EC04 | S10_R04 | East Cooper Island | DZ4 | 28.0 | -45.73700 | 166.8860 | -46° 15.780’ | 166° 53.157’ |
| EC05 | S10_R05 | East Cooper Island | DZ4 | 70.0 | -45.72872 | 166.8818 | -46° 16.277’ | 166° 52.906’ |
| EC06 | S10_R06 | East Cooper Island | DZ4 | 58.0 | -45.72575 | 166.8994 | -46° 16.455’ | 166° 53.962’ |
| SC01 | S11_R01 | Supper Cove | DZ4 | 25.4 | -45.70307 | 166.9534 | -46° 17.816’ | 166° 57.202’ |
| SC02 | S11_R02 | Supper Cove | DZ4 | 55.0 | -45.70700 | 166.9553 | -46° 17.580’ | 166° 57.318’ |
| SC03 | S11_R03 | Supper Cove | DZ4 | 64.0 | -45.71162 | 166.9528 | -46° 17.303’ | 166° 57.168’ |
| SC04 | S11_R04 | Supper Cove | DZ4 | 65.0 | -45.70937 | 166.9479 | -46° 17.438’ | 166° 56.877’ |
| SC05 | S11_R05 | Supper Cove | DZ4 | 54.0 | -45.70732 | 166.9435 | -46° 17.561’ | 166° 56.612’ |
| SC06 | S11_R06 | Supper Cove | DZ4 | 23.0 | -45.70253 | 166.9462 | -46° 17.848’ | 166° 56.773’ |
| SH01 | S12_R01 | Shark Cove | DZ4 | 71.4 | -45.72023 | 166.9660 | -46° 16.786’ | 166° 57.959’ |
| SH02 | S12_R02 | Shark Cove | DZ4 | 51.0 | -45.71955 | 166.9714 | -46° 16.827’ | 166° 58.284’ |
| SH03 | S12_R03 | Shark Cove | DZ4 | 28.0 | -45.71705 | 166.9761 | -46° 16.977’ | 166° 58.567’ |
| SH04 | S12_R04 | Shark Cove | DZ4 | 33.0 | -45.72855 | 166.9508 | -46° 16.287’ | 166° 57.050’ |
| SH05 | S12_R05 | Shark Cove | DZ4 | 51.0 | -45.73150 | 166.9468 | -46° 16.110’ | 166° 56.808’ |
| SH06 | S12_R06 | Shark Cove | DZ4 | 32.0 | -45.72108 | 166.9484 | -46° 16.735’ | 166° 56.902’ |
| FB01 | S13_R01 | Cooper Island | DZ4 | 27.0 | -45.73793 | 166.8813 | -46° 15.724’ | 166° 52.881’ |
| FB02 | S13_R02 | Cooper Island | DZ4 | 45.0 | -45.74085 | 166.8779 | -46° 15.549’ | 166° 52.673’ |
| FB03 | S13_R03 | Cooper Island | DZ4 | 52.0 | -45.74118 | 166.8691 | -46° 15.529’ | 166° 52.148’ |
| FB04 | S13_R04 | Cooper Island | DZ4 | 27.0 | -45.75247 | 166.8626 | -46° 14.852’ | 166° 51.757’ |
| FB05 | S13_R05 | Fanny Bay | DZ4 | 62.0 | -45.76213 | 166.8347 | -46° 14.272’ | 166° 50.083’ |
| FB06 | S13_R06 | Fanny Bay | DZ4 | 71.0 | -45.77178 | 166.8419 | -46° 13.693’ | 166° 50.514’ |
| NC01 | S14_R01 | North Cooper Island | DZ4 | 55.0 | -45.71055 | 166.8425 | -46° 17.367’ | 166° 50.547’ |
| NC02 | S14_R02 | North Cooper Island | DZ4 | 32.0 | -45.70575 | 166.8288 | -46° 17.655’ | 166° 49.729’ |
| NC03 | S14_R03 | North Cooper Island | DZ4 | 85.0 | -45.71613 | 166.7994 | -46° 17.032’ | 166° 47.963’ |
| NC04 | S14_R04 | North Cooper Island | DZ4 | 18.0 | -45.71837 | 166.7825 | -46° 16.898’ | 166° 46.952’ |
| NC05 | S14_R05 | North Cooper Island | DZ4 | 28.0 | -45.72338 | 166.7607 | -46° 16.597’ | 166° 45.640’ |
| NC06 | S14_R06 | North Cooper Island | DZ4 | 18.0 | -45.72658 | 166.7987 | -46° 16.405’ | 166° 47.924’ |
| SI07 | S15_R01 | Shag Island | DZ4 | 42.1 | -45.72988 | 166.7899 | -46° 16.207’ | 166° 47.394’ |
| SI08 | S15_R02 | Shag Island | DZ4 | 36.0 | -45.73352 | 166.7811 | -46° 15.989’ | 166° 46.869’ |
| SI09 | S15_R03 | Shag Island | DZ4 | 46.0 | -45.73128 | 166.7773 | -46° 16.123’ | 166° 46.637’ |
| SI10 | S15_R04 | Shag Island | DZ4 | 15.0 | -45.73295 | 166.7671 | -46° 16.023’ | 166° 46.026’ |
# fld24_toprint |> write_csv(file = "data/fld24_toprint.csv")First mapviews
mapview(fld24)map_fiordland24 <- fld24 |>
mutate(Depth = -Depth) |>
mapview(zcol="Depth", layer.name = "BRUV drops (Depth)") +
mapview(mr_fiordland |>
filter(Name %in% c(
"Moana Uta (Wet Jacket Arm) Marine Reserve",
"Taumoana (Five Finger Peninsula) Marine Reserve"
)),
layer.name = "Marine Reserves",
col.region = "yellow")
map_fiordland24saveRDS( map_fiordland24, "maps/map_fiordland24.rds")
mapshot(map_fiordland24, url = "maps/map_fiordland24.html")nrow(fld24)[1] 136
fld24 |>
group_by(Quality) |>
summarise(n = n())Simple feature collection with 2 features and 2 fields
Geometry type: MULTIPOINT
Dimension: XY
Bounding box: xmin: 166.4598 ymin: -45.80528 xmax: 166.9761 ymax: -45.68888
Geodetic CRS: WGS 84
# A tibble: 2 × 3
Quality n geometry
<chr> <int> <MULTIPOINT [°]>
1 Good 120 ((166.5305 -45.68888), (166.524 -45.69353), (166.5012 -45.70938…
2 OK 16 ((166.465 -45.73392), (166.4979 -45.71433), (166.6521 -45.74692…
fld24 |>
group_by(`Repeat site from 2021`) |>
summarise(n = n())Simple feature collection with 2 features and 2 fields
Geometry type: MULTIPOINT
Dimension: XY
Bounding box: xmin: 166.4598 ymin: -45.80528 xmax: 166.9761 ymax: -45.68888
Geodetic CRS: WGS 84
# A tibble: 2 × 3
`Repeat site from 2021` n geometry
<chr> <int> <MULTIPOINT [°]>
1 No 112 ((166.5305 -45.68888), (166.524 -45.69353), (16…
2 Yes 24 ((166.5152 -45.77767), (166.5058 -45.77522), (1…
fld24 |>
filter(Quality != "BAD") |>
summarise(
min = min(Depth),
max = max(Depth),
mean = mean(Depth),
median = median(Depth)
)Simple feature collection with 1 feature and 4 fields
Geometry type: MULTIPOINT
Dimension: XY
Bounding box: xmin: 166.4598 ymin: -45.80528 xmax: 166.9761 ymax: -45.68888
Geodetic CRS: WGS 84
# A tibble: 1 × 5
min max mean median geometry
<dbl> <dbl> <dbl> <dbl> <MULTIPOINT [°]>
1 14.2 86 40.8 36 ((166.5305 -45.68888), (166.524 -45.69353), (166.501…
Calculate areas
strata_clipped <- strata |>
st_transform(2193) |>
st_difference( nztm |> st_union() ) Warning: attribute variables are assumed to be spatially constant throughout
all geometries
plot(strata_clipped)strata_areas <- strata_clipped |>
mutate( Area = ( strata |> st_area() / 1e6 ) |> units::drop_units()) |>
select(Name, Area) |>
st_drop_geometry()st_as_s2(): dropping Z and/or M coordinate
strata_samples <- fld24 |>
filter(Quality != "Bad") |>
group_by(Name) |>
summarise(n = n()) |>
st_drop_geometry() |>
left_join(strata_areas) |>
mutate(
Area = round(Area, 1),
Sites_per_area = round(n / Area, 3)
) Joining with `by = join_by(Name)`
strata_samples# A tibble: 5 × 4
Name n Area Sites_per_area
<chr> <int> <dbl> <dbl>
1 DR2 14 23.2 0.603
2 DZ1 22 57.5 0.383
3 DZ2 33 54.8 0.602
4 DZ3 30 74.1 0.405
5 DZ4 37 76.1 0.486
kable(strata_samples)| Name | n | Area | Sites_per_area |
|---|---|---|---|
| DR2 | 14 | 23.2 | 0.603 |
| DZ1 | 22 | 57.5 | 0.383 |
| DZ2 | 33 | 54.8 | 0.602 |
| DZ3 | 30 | 74.1 | 0.405 |
| DZ4 | 37 | 76.1 | 0.486 |
fld24 |> filter(Quality != "Bad") |> ggplot() + aes(x=Depth) + geom_histogram() `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
fld24 |>
filter(Quality != "Bad") |>
ggplot() + aes(x=Depth) + geom_histogram() + facet_wrap(vars(Name))`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Depths
fld24 |>
ggplot() +
aes(x = `Depth sounder`, y = `Depth sensor`) +
geom_point() +
geom_abline(slope=1, intercept = 0)Warning: Removed 24 rows containing missing values or values outside the scale range
(`geom_point()`).
Mappy map map
bathy_tamatea <- readRDS("data/bathy_tamatea.rds")lim_tamatea_nzmg <- ext( c(2000000, 2042000, 5464000, 5488000) )Points and strata 2024
ggmap_fld24_strata <- ggplot() +
geom_spatraster(data = bathy_tamatea) +
scale_fill_hypso_c(name = "Depth (m)", palette="colombia_bathy") +
new_scale_fill() +
geom_sf(
data = strata |>
filter(Name %in% dstrat),
aes(fill = Name),
colour = 'black',
alpha = .5
) +
geom_sf(data = nztm, fill='grey40', colour=NA) +
geom_sf(data = fld24, size = 2, color = "black") +
geom_sf_text(
data = strata |>
filter(Name %in% dstrat),
aes(label = Name),
colour = "white",
nudge_y = c(-1500,0,0,0,0)) + # Label strata
scale_fill_brewer(name = "Stratum", palette = "Set2") +
# scale_fill_viridis_d(name = "Stratum", option = "C", alpha = 0.7) +
scale_x_continuous(limits = lim_tamatea_nzmg[1:2],
expand = c(0, 0)) +
scale_y_continuous(limits = lim_tamatea_nzmg[3:4],
expand = c(0, 0)) +
annotation_scale(location = "br") +
annotate("text", label = "Sea Through Science Ltd.") +
xlab("") + ylab("")<SpatRaster> resampled to 500760 cells.
ggmap_fld24_strataggmap_fld24_strata +
annotation_custom(mark, xmin = 2031500, xmax = 2042000, ymin = 5464000, ymax = 5470000)ggsave("maps/map_fld24_strata.png", width = 10, height = 6, dpi = 300)Strata with Breaksea too
get bbox
strata_nzmg <- strata |>
st_transform(strata, crs = 27200)
bbox_strata <- strata_nzmg |>
st_bbox()
bbox_strata xmin ymin xmax ymax
1995923 5464579 2042666 5507907
ggmap_allstrata <- ggplot() +
# geom_spatraster(data = bathy_tamatea, alpha = 0.1) +
#
# scale_fill_hypso_c(name = "Depth (m)", palette="colombia_bathy") +
# new_scale_fill() +
geom_sf(
data = strata_nzmg |>
st_transform(strata, crs = 27200),
aes(fill = Name),
colour = 'black',
alpha = .5
) +
geom_sf(data = nztm, fill='grey40', colour=NA) +
geom_sf(data = fld24, size = 2, color = "black", alpha = .5) +
geom_sf_text(
data = strata,
aes(label = Name),
colour = "black",
fontface = "bold",
nudge_y = c(0,0,0,500,-1500,0,0,0,0,0,0,0,0)
) + # Label strata
# scale_fill_brewer(name = "Stratum", palette = "Set2") +
scale_x_continuous(limits = c(bbox_strata["xmin"], bbox_strata["xmax"]),
expand = c(0, 0)) +
scale_y_continuous(limits = c(bbox_strata["ymin"], bbox_strata["ymax"]),
expand = c(0, 0)) +
annotation_scale(location = "br") +
annotate("text", label = "Sea Through Science Ltd.") +
xlab("") + ylab("") +
theme(legend.position = "none")
ggmap_allstrataggmap_allstrata +
annotation_custom(mark, xmin = 2031500, xmax = 2042000, ymin = 5464000, ymax = 5470000)ggsave("maps/map_allstrata.png", width = 8, height = 8, dpi = 300)
ggsave("maps/map_allstrata.pdf", width = 8, height = 8)Labelled map of 2024 sites
ggmap_fld24_labels <-
ggmap_fld24_strata +
geom_label_repel(
data = fld24, # |>
# mutate(
# X = st_coordinates(fld24)[,1],
# Y = st_coordinates(fld24)[,2]
# ),
aes(label = SiteID, geometry = geometry),
stat = "sf_coordinates",
# size = 1,
max.overlaps = 12,
alpha = 0.6,
box.padding = 0.05,
point.padding = 0.05,
min.segment.length = 0)
ggmap_fld24_labelsggmap_fld24_labels +
annotation_custom(mark, xmin = 2031500, xmax = 2042000, ymin = 5464000, ymax = 5470000)ggsave("maps/map_fld24_labels.png", width = 18, height = 13, dpi = 300)
ggsave("maps/map_fld24_labels.pdf", width = 18, height = 13)Points and reserves
ggmap_fld24 <- ggplot() +
geom_spatraster(data = bathy_tamatea) +
geom_sf(
data = mr_fiordland,
fill = "yellow", col = NA, alpha = .3
) +
geom_sf(data = nztm, fill='grey40', colour=NA) +
geom_sf(
data = fld24,
size = 2
) +
scale_fill_hypso_c(name = "Depth (m)", palette="colombia_bathy") +
new_scale_fill() +
scale_x_continuous(limits = lim_tamatea_nzmg[1:2],
expand = c(0, 0)) +
scale_y_continuous(limits = lim_tamatea_nzmg[3:4],
expand = c(0, 0)) +
annotation_scale(location = "br") +
annotate("text", label = "Sea Through Science Ltd.")<SpatRaster> resampled to 500760 cells.
ggmap_fld24ggmap_fld24 +
annotation_custom(mark, xmin = 2031500, xmax = 2042000, ymin = 5464000, ymax = 5470000)ggsave("maps/map_fld24.png", width = 10, height = 6, dpi = 300)